/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JEventListFrame.java
 *
 * Created on 2010-maj-19, 10:46:58
 */

package foalvleditor.gui;

import foalvleditor.gameobjects.GameEvent;
import javax.swing.JPanel;

/**
 *
 * @author Mikael
 */
public class JEventListFrame extends javax.swing.JInternalFrame {

    /**
	 *
	 */
	private static final long serialVersionUID = 1L;
	/** Creates new form JEventListFrame */
    public JEventListFrame() {
        super();
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */

    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jEventListPanel = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        setIconifiable(true);
        setResizable(true);
        setMaximumSize(new java.awt.Dimension(370, 1000));
        setMinimumSize(new java.awt.Dimension(370, 120));
        setName("Form"); // NOI18N
        setPreferredSize(new java.awt.Dimension(370, 150));

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jEventListPanel.setName("jEventListPanel"); // NOI18N
        jEventListPanel.setLayout(new javax.swing.BoxLayout(jEventListPanel, javax.swing.BoxLayout.Y_AXIS));
        jScrollPane1.setViewportView(jEventListPanel);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 360, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new JEventListFrame().setVisible(true);
            }
        });
    }

    public JPanel getPanel(){
        return this.jEventListPanel;
    }

    public void clearEvents(){
        jEventListPanel.removeAll();
        jEventListPanel.revalidate();
        jEventListPanel.repaint();
    }

    public void addEvent(GameEvent event){
        jEventListPanel.add(new JEventPanel(event));
        this.revalidate();
        this.repaint();
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel jEventListPanel;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables

}
